package day13.KeJian;

import java.io.FileReader;
import java.io.IOException;

public class InputStreamReaderDemo {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("D://itheima//nb.txt");
        //m1(fr);
        m2(fr);
    }

    private static void m2(FileReader fr) throws IOException {
        //int read(char[] cbuf)：一次读一个字符数组数据
        char[] chs = new char[1024];
        int len;
        while ((len=fr.read(chs))!=-1){
            System.out.println(new String(chs,0,len));
        }
        fr.close();
    }

    private static void m1(FileReader fr) throws IOException {
        //int read()一次读一个字符数据
        int ch;
        while ((ch = fr.read())!=-1){
            System.out.println((char)ch);
        }
        fr.close();
    }
}
